<#assign ctx=request.contextPath/>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>确定订单页</title>
		<link rel="stylesheet" href="${ctx}/css/bootstrap.css" />
		<link rel="stylesheet" href="${ctx}/css/common.css" />
		<link rel="stylesheet" href="${ctx}/css/confirm_order.css" />
		<script type="text/javascript" src="${ctx}/js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="${ctx}/js/bootstrap.js" ></script>
		<script type="text/javascript" src="${ctx}/js/confirm_order.js" ></script>
		<script type="text/javascript" src="${ctx}/js/myjs.js"></script> 	
	</head>
<body style="background:#f0f0f0;">
		<#include "common/top.html"/>
			<article class="center">
				<header class="content_top">
					<h3>确定订单页</h3>
				</header>
				<div class="order_top">
					<h4>填写并核对订单信息</h4>
				</div>
				<div class="order_info">
					<h4>收货人信息</h4>
					<span><a href="#">新增收货地址</a></span>
					<input type="hidden" id="addressId" >
					<ul id="info" >
						
					</ul>
					<script type="text/javascript">
						$(function(){
							
							//通过ajax获得默认的地址
							$.post("${ctx}/customer/address/getDefaultAddress",function(data){
								
								var liOne = $("<li></li>").text(data.user.user_id);
								var liTwo = $("<li></li>").text(data.picaddress);
								var liThree = $("<li></li>").text(data.telephone);
								var defaultA = $("<a></a>").attr("href","#").text("默认地址");
								var liThour = $("<li></li>");
								var lififth = $("<li></li>");
								defaultA.appendTo(liThour);
								var editA = $("<a></a>").attr("href","#").text("编辑");
								var deleteA = $("<a></a>").attr("href","#").text("删除");
								editA.appendTo(lififth);
								deleteA.appendTo(lififth);
								
								liOne.appendTo("#info");
								liTwo.appendTo("#info");
								liThree.appendTo("#info");
								liThour.appendTo("#info");
								lififth.appendTo("#info");
								
								$("#addressId").val(data.id);
							});							
						});
					</script>
					
				<div class="order_style clear">
					<h4>支付方式</h4>
						<ul>
							<li class="on"><a href="javascript:void(0);" >支付宝支付</a></li>
							<li><a href="javascript:void(0);">货到付款</a></li>
							<li><a href="javascript:void(0);">微信支付</a></li>
						</ul>
				</div>
				<div class="order_menu clear">
					<h4>送货清单</h4>
					
					
				</div>
				<div class="order_bottom">
					<p>${goodsCount!''}件商品，总商品金额：<em>￥</em><span>${total?c}</span></p>
					<P>返还：<em>￥</em><span>0.00</span></P>
					<p>运费：<em>￥</em><span>0.00</span></p>
					<input id="ids" type="hidden" value="${ids}" >
					<p>应付总金额：<em>￥</em><span id="total" >${total?c}</span></p>
					<a id="subOrder" href="javaScript:voic(0);">提交订单</a>
					<script type="text/javascript">
						$(function(){							
							$("#subOrder").click(function(){
								
								var addressId = $("#addressId").val();
								var ids = new Array();
								var getIds = $("#ids").val();

								ids = getIds.split("-");
								//过滤掉空值
								for(var i = 0;i<ids.length;i++){
									if(ids[i].length == 0) ids.splice(i,1);
								}
								
								
								var total = $("#total").text();
								
								console.log(ids);
								
  								window.location.href = 
								"${ctx}/customer/order/addorder?ids="+ids+"&total="+total+"&addressId="+addressId;
					 		 
							});							
						});
					</script>
				</div>
			</div>
		</article>
	<#include "common/bottom.html"/>
